package com.wgy.day13.Random随机产生数字;

import java.util.Random;

public class Demo06Random {
    public static void main(String[] args) {
        Random r = new Random();
        int n = 5;
        for (int i = 0; i < 100; i++) {
            int a = r.nextInt(n) + 1;//原本获取的整数范围是[0,n), 整体+1后就变成了[1,n+1),即就是[1,n].
            System.out.println(a);
        }

    }
}
